package com.lz.sports.vm

import androidx.lifecycle.LifecycleOwner
import com.lz.library.base.BaseModel
import com.lz.library.base.BaseViewModel
import com.lz.ub.UBCCallback
import com.lz.ub.UBCDevice
import com.lz.ub.UBCManager

class TestViewModel  : BaseViewModel<BaseModel>(), UBCCallback {

    override fun onCreate(owner: LifecycleOwner) {
        UBCManager.get().restart()


    }

    fun add1() {
//        UBCManager.get().addDevice("C1:FD:36:FF:16:85", 11, 19, false)

    }

    fun add2() {
//        UBCManager.get().addDevice("FA:2F:3F:8A:EF:28", 11, 10, false)
    }

    fun connectAll() {
//        UBCManager.get().connect()
    }

    fun connect1() {
        UBCManager.get().scan()
    }

    fun connect2() {
        UBCManager.get().stopScan()
    }

    fun test1() {
        UBCManager.get().pushHexCommand("A508020000003CEB")
    }

    fun test2() {
        UBCManager.get().pushHexCommand("A5050300AD")
    }

    fun test3() {
        UBCManager.get().pushHexCommand("A5050305B2")
    }

    fun disconnectAll() {
        UBCManager.get().disconnect()
    }

    fun reset() {

    }

    override fun onReadHex(device: UBCDevice, bytes: ByteArray, start: Int, size: Int, isAssist: Boolean) {
    }

    override fun onRead(device: UBCDevice, data: String, isAssist: Boolean) {

    }

    override fun onConnected(device: UBCDevice, isAssist: Boolean) {

    }

    override fun onDisconnected(device: UBCDevice, isAssist: Boolean) {

    }
}